package com.armani.service.impl;

import com.armani.entity.Pay;
import com.armani.mapper.PayMapper;
import com.armani.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @ProjectName: armani
 * @Package: com.armani.service.impl
 * @ClassName: PayServiceImpl
 * @Description: TODO
 * @Author: Roc
 * @Date: 2021/11/28 18:16
 * @Version: 1.0
 **/
@Service
public class PayServiceImpl implements PayService {

    @Autowired
    private PayMapper payMapper;

    @Override
    public List<Pay> ListSearch(Integer userId, Integer state,
                                String startTime, String endTime ,Integer startRow, Integer limit) {
        return payMapper.ListSearch(userId,state,startTime,endTime,startRow,limit);
    }

    @Override
    public Integer getCount(Integer userId, Integer state,
                            String startTime, String endTime ) {
        return payMapper.getCount(userId,state,startTime,endTime);
    }

    @Override
    @Transactional
    public Integer insert(Integer userId, Integer orderId, Date payTime, BigDecimal payment, Integer payway, Integer state) {
        return payMapper.insert(userId,orderId,payTime,payment,payway,state);
    }

    @Override
    @Transactional
    public Integer update(Integer userId, Integer orderId, Date payTime, BigDecimal payment, Integer payway, Integer state, Integer id) {
        return payMapper.update(userId,orderId,payTime,payment,payway,state,id);
    }

    @Override
    @Transactional
    public Integer delete(Integer id) {
        return payMapper.delete(id);
    }
}
